<include file="./Public/bg/bgheader.html" />
<include file="./Public/bg/bglefter.html" />


<div class=" admin-content">
		<div class="daohang">
			<ul>
				<li><button type="button" class="am-btn am-btn-default am-radius am-btn-xs"> 首页 </li>
				<li><button type="button" class="am-btn am-btn-default am-radius am-btn-xs">帮助中心<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close="">×</a></button></li>
				<li><button type="button" class="am-btn am-btn-default am-radius am-btn-xs">奖金管理<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close="">×</a></button></li>
				<li><button type="button" class="am-btn am-btn-default am-radius am-btn-xs">产品管理<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close="">×</a></button></li>
			</ul>
		</div>
</div>
	
	


<div class="admin">
   <div class="admin-index">
      <script type="text/javascript">jQuery(".slideTxtBox").slide();</script> 
	   <div class="admin-index">
      <script type="text/javascript">jQuery(".slideTxtBox").slide();</script> 
   
   		<div class="listbiaoti am-cf">
      <ul class="am-icon-flag on"> 添加视频</ul>
      
      <dl class="am-icon-home" style="float: right;"> 当前位置： 视频添加 &gt; <a href="#">添加视频</a></dl>

      
      
    </div>
    <div class="am-popup-bd">
        <form id="tf" enctype="multipart/form-data" class="am-form tjlanmu" method="post" action="{:U('addinsert')}">
          <div class="am-form-group">
            <div class="zuo">视频名称：</div>
            <div class="you">
              <input type="text" style="width:30%" name="video_name" class="am-input-sm" id="doc-ipt-email-1"  placeholder="视频名称"/>
            </div>
          </div>
           <div class="am-form-group am-cf">
            <div class="zuo">视频预览图上传：</div>
            <div class="you" style="height: 45px;">
            	<input type="file" accept="image/gif,image/png,image/bmp,image/jpeg" name="video_pic"/>
              <p class="am-form-help">请选择要上传的视频预览图...</p>
            </div>
          </div>
          <div class="am-form-group">
            <div class="zuo">视频上传：</div>
            <div class="you">
              <input type="file" name="video_video"/>
              <p class="am-form-help">请选择要上传的视频...</p>
            </div>
          </div>
           <div class="am-form-group">
            <div class="zuo">启用状态：</div>
            <div class="you">
             <select style="width:30%" name="video_status">  
				  <option value ="0">未启用</option>  
				  <option value ="1" selected>已启用</option>  
				</select>  
            </div>
          </div>
          <div class="am-form-group">
            <div class="zuo">删除状态：</div>
            <div class="you">
             <select style="width:30%" name="video_del">  
				  <option value ="0" selected>未删除</option>  
				  <option value ="1" >已删除</option>  
				</select>  
            </div>
          </div>
		  <div class="am-form-group">
            <div class="zuo">排序等级：</div>
            <div class="you">
             <select style="width:30%" name="video_order">  
				  <option value ="1" selected>一级</option>  
				  <option value ="2" >二级</option>  
				  <option value ="3" >三级</option>  
				  <option value ="4" >四级</option>  
				  <option value ="5" >五级</option>  
				  <option value ="6" >六级</option>  
				  <option value ="7" >七级</option>  
				  <option value ="8" >八级</option>  
				  <option value ="9" >九级</option>  
				</select>
				<span style="color: red;">*等级越高排序位置越靠前</span> 
            </div>
          </div>
          <div class="am-form-group am-cf">
            <div class="you" style="margin-top:2%;">
              <p>
				<button onclick="javascript:formpost();" href="javascript:void(0);" class="am-btn am-btn-warning am-radius">上传</button>
                <button type="reset" class="am-btn am-btn-warning am-radius">重置</button>
              </p>
            </div>
          </div>
        </form>
      </div>
	</div>
</div>
</div>
<script type="text/javascript">
	// /**
	//  * 校验视频
	//  */
	function checkTv(){
	 var tv_id =$("input[name='video_video']").val();//根据id得到值
	 var index= tv_id.indexOf("."); //得到"."在第几位
	 tv_id=tv_id.substring(index); //截断"."之前的，得到后缀
	     if(tv_id!=".mp4"&&tv_id!=".rmvb"&&tv_id!=".avi"&&tv_id!=".ts"&&tv_id!=".wmv"){ //根据后缀，判断是否符合视频格式
	         alert("不是指定视频格式,重新选择"); 
	       $("input[name='video']").val()="";   // 不符合，就清除，重新选择
	     }
	}
	/**
	 * form表单上传
	 * @return {[type]} [description]
	 */
	 function formpost(){
            var form = new FormData(document.getElementById("tf"));
//             var req = new XMLHttpRequest();
//             req.open("post", "${pageContext.request.contextPath}/public/testupload", false);
//             req.send(form);
            $.ajax({
                url:"{:U('addinsert')}",
                type:"post",
                data:form,
                processData:false,
                contentType:false,
                success:function(data){
                    window.clearInterval(timer);
                    console.log("over..");
                },
                error:function(e){
                    alert("错误！！");
                    window.clearInterval(timer);
                }
            });        
            get();//此处为上传文件的进度条
        }

</script>  
<include file="./Public/bg/bgfooter.html" />
